import math
import random

numbers = [-5, 0, 5, 10, 15]

print("内置数学函数:")
for num in numbers:
    print(f"abs({num}) = {abs(num)}")          # 绝对值

print(f"\n最大值: {max(1, 5, 2, 8, 3)}")      # 8
print(f"最小值: {min(1, 5, 2, 8, 3)}")        # 1
print(f"求和: {sum([1, 2, 3, 4, 5])}")        # 15


for num in range(5):
    print(f"随机取得1000的随机数{math.floor(random.random() * 1000)}")

# 更多数学函数
print(f"\n高级数学函数:")

print(f"2的3次方: {pow(2, 3)}")               # 8
print(f"四舍五入: {round(3.14159, 2)}")       # 3.14
print(f"向上取整: {math.ceil(3.14)}")         # 4
print(f"向下取整: {math.floor(3.14)}")         # 3

x = int(3 ** 0.5)
print(3**0.5)
print(27**(1/3))
print(math.pow(16,1/2))
print(f"{x}=={x}")